#include<bits/stdc++.h>
#define int long long
#define ls(x) ((x)*2)
#define rs(x) ((x)*2+1)
#define Debug(...) fprintf(stderr, __VA_ARGS__)
#define For(i,a,b) for(int i=a,i##end=b;i<=i##end;i++)
#define Rof(i,a,b) for(int i=a,i##end=b;i>=i##end;i--)
#define rep(i,  b) for(int i=1,i##end=b;i<=i##end;i++)
using namespace std;
const int N=1e6+5,base=999983,Mod=998244353;
//char buf[(1<<21)+5],*p1,*p2;
//#define getchar() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<21,stdin),p1==p2)?EOF:*p1++)
inline void chmx(int &x,int y){(x<y)&&(x=y);}
inline void chmn(int &x,int y){(x>y)&&(x=y);}
inline void Add(int &x,int y){(x=x+y+Mod)%=Mod;}
inline int read(){
	int f=0,x=0;
	char ch=getchar();
	while(!isdigit(ch)){f|=(ch=='-');ch=getchar();}
	while(isdigit(ch)){x=(x<<3)+(x<<1)+(ch^48);ch=getchar();}
	return f?-x:x;
}
void print(int n){
    if(n<0){
        putchar('-');
        n*=-1;
    }
    if(n>9) print(n/10);
    putchar(n%10+'0');
}
char s[N],t[N];
int n,m;
int dp[2005][2005],path[2005][2005];
int gg[N],tot;
int col[N],color[N],cnt=0;
int pre[N],suf[N];
inline int len(int x){
	return gg[x+1]-gg[x];
}
int ans[N],AS;
int val[2005][2005],lst[2005][2005];
signed main(){
	freopen("seq.in","r",stdin);
	freopen("seq.out","w",stdout);
	// ios::sync_with_stdio(false);
	// cin.tie(0); cout.tie(0);
	scanf("%s",s+1);scanf("%s",t+1);
	n=strlen(s+1),m=strlen(t+1);
	For(i,1,n) if(s[i]!=s[i-1]) gg[++tot]=i;
	gg[++tot]=n+1;
	For(i,1,n) color[i]=upper_bound(gg+1,gg+tot+1,i)-gg-1;
	int ss=1;
	For(i,2,m){
		if(t[i]==t[i-1])ss++;
		else col[++cnt]=ss,ss=1;
 	}
 	if(n<=2000){
 		if(s[1]==t[1]) dp[1][1]=1,val[1][1]=1,path[1][1]=1;
 		bool flag=1;
 		For(i,2,n){
 			if(s[i]==t[1]) dp[i][1]=flag;
 			if(s[i]!=s[1])flag=0;
 			if(s[i]!=s[i-1]){
 				For(j,1,m){
 					if(t[j+1]==s[i]&&t[j]==s[i-1]){
 						dp[i][j+1]|=val[color[i-1]][j];
 						if(val[color[i-1]][j]) path[i][j+1]=lst[color[i-1]][j];
					 }
 					if(t[j+1]==s[i]&&t[j]==s[i]){
 						dp[i][j+1]|=dp[gg[color[i-1]]-1][j];
 						if(dp[gg[color[i-1]]-1][j]) path[i][j+1]=gg[color[i-1]]-1;
					}
				}
			}
			else{
 				For(j,1,m){
 					if(t[j+1]==s[i]&&t[j]==s[i-1]){
 						dp[i][j+1]|=val[color[i]][j];
 						if(val[color[i]][j]) path[i][j+1]=lst[color[i]][j];
 						
					 }
 					if(t[j+1]==s[i]&&t[j]!=s[i]){
 						dp[i][j+1]|=dp[gg[color[i]]-1][j];
 						if(dp[gg[color[i]]-1][j]) path[i][j+1]=gg[color[i]]-1;
					}
				}
			}
			For(j,1,m){
				val[color[i]][j]|=dp[i][j];
				if(dp[i][j]) lst[color[i]][j]=i;
//				cout<<dp[i][j]<<" ";
			} 
//			puts("");
		}
		Rof(i,n,1){
			if(dp[i][m]){
				int k=i,kk=m;
				while(kk){
					ans[++AS]=k;
					k=path[k][kk];
					kk--;
				}
				sort(ans+1,ans+AS+1);
				for(int i=0;i<=AS;i++){
					bool flag=0;
					for(int j=ans[i]+2;j<=ans[i+1]-1;j++)if(s[j]!=s[j-1]) flag=1;
					if(flag) puts("NO");
					if(flag)return 0;
				}
				For(i,1,AS){
					if(s[ans[i]]!=t[i])puts("NO");
					if(s[ans[i]]!=t[i])return 0;
				}
				puts("YES");
				For(i,1,AS) printf("%lld ",ans[i]);
				ans[AS+1]=n+1;
				return 0;
			}
			
			if(s[i]!=s[n]) break;
		}
		puts("NO");
		return 0;
	}
 	col[++cnt]=ss;
	int p=1;
	if(s[1]!=t[1])p++;
 	For(i,1,cnt){
 		int x=col[i];
 		while(1){
 			if(x>len(p)){
 				x-=len(p);
				p+=2;
				if(p>tot){
					puts("NO");
					return 0;
				}	
			}
			else{
				break;
			}
		}p++;
		pre[i]=gg[p-1]+x-1;
	}
	int tt=tot-1;
	if(s[n]!=t[m]) tt--;
	Rof(i,cnt,1){
		int x=col[i];
		if(suf[i+1]==gg[tt+1]){
			if(x==1){
				suf[i]=gg[tt];
				tt--;
				continue;
			}
			x--;
			tt-=2;
		}
		while(1){
			if(t==0) break;
			if(x>min(2ll,len(tt))){
				x-=min(2ll,len(tt));
				tt-=2;
			}
			else{
				if(x==1)suf[i]=gg[tt+1]-1;
				if(x==2)suf[i]=gg[tt];
				break;
			}
		}tt--;
	}
	suf[cnt+1]=n;
	For(jj,1,cnt){
		if(pre[jj]<=suf[jj+1]&&suf[jj]>=pre[jj-1]){
			puts("YES");
			int p=1;
			if(s[1]!=t[1])p++;
		 	For(i,1,jj-1){
		 		int x=col[i];
		 		while(1){
		 			if(x>len(p)){
		 				x-=len(p);
		 				For(j,gg[p],gg[p+1]-1)ans[++AS]=j;
						p+=2;
						
					}
					else{
						break;
					}
				}p++;
				For(j,gg[p-1],gg[p-1]+x-1)ans[++AS]=j;
			}
			int tt=tot-1;
			if(s[n]!=t[m]) tt--;
			Rof(i,cnt,jj+1){
				int x=col[i];
				if(suf[i+1]==gg[tt+1]){
					if(x==1){
						ans[++AS]=gg[tt];
						tt--;
						continue;
					}
					x--;
					ans[++AS]=gg[tt];
					tt-=2;
				}
				while(1){
					if(t==0) break;
					if(x>min(2ll,len(tt))){
						if(len(tt)==1) ans[++AS]=gg[tt];
						else ans[++AS]=gg[tt],ans[++AS]=gg[tt+1]-1;
						x-=min(2ll,len(tt));
						tt-=2;
					}
					else{
						if(x==1)ans[++AS]=gg[tt+1]-1;
						if(x==2)ans[++AS]=gg[tt];
						break;
					}
				}tt--;
			}
			int lst=ans[AS],num=col[jj];
			if(lst==gg[tt+2]-1) ans[++AS]=gg[tt+1]-1,num--;
			for(int j=tt;j>=p;j-=2){
				if(num==0) break;
				if(len(j)==1) ans[++AS]=gg[j],num--;
				else{
					if(num==0) break;
					if(gg[j+1]-1!=lst&&gg[j+1]-1!=n)ans[++AS]=gg[j+1]-1,num--;
					
					if(num==0) break;
					if(gg[j]!=1)ans[++AS]=gg[j];num--;
				}
				if(num==0) break;
			}
			for(int j=p;j<=tt;j+=2){
				For(tt,gg[j]+1,gg[j+1]-2){
					if(num==0)break;
					ans[++AS]=tt,num--;
				}
					if(num==0)break;
			}
			sort(ans+1,ans+AS+1);
				for(int i=0;i<=AS;i++){
					bool flag=0;
					for(int j=ans[i]+2;j<=ans[i+1]-1;j++)if(s[j]!=s[j-1]) flag=1;
					if(flag) puts("NO");
					if(flag)return 0;
				}
				For(i,1,AS){
					if(s[ans[i]]!=t[i])puts("NO");
					if(s[ans[i]]!=t[i])return 0;
				}
			For(i,1,AS) printf("%lld ",ans[i]);
			ans[AS+1]=n+1;
			return 0;
			
		}
	} puts("NO");
#ifdef LOCAL
    Debug("\nMy Time: %.3lfms\n", (double)clock() / CLOCKS_PER_SEC);
#endif
	return 0;
}
/*
0001101101
0110
11101110111011101110111
00000
*/
